﻿<Window x:Class="InterLinq.Test.UI.SampleApplication"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" WindowStartupLocation="CenterScreen"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Window.Resources>
        <Style TargetType="{x:Type TabItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabItem}">
                        <Grid Width="110" Height="30" Margin="0,10" >
                            <Border  CornerRadius="3" >
                                <Border.Background>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Color="Black" Offset="0"></GradientStop>
                                        <GradientStop Color="Silver" Offset="0.1"></GradientStop>
                                        <GradientStop Color="Silver" Offset="0"></GradientStop>
                                        <GradientStop Color="Black" Offset="1"></GradientStop>
                                    </LinearGradientBrush>
                                </Border.Background>

                            </Border>
                            <Border Width="100" Height="20" VerticalAlignment="Top" Margin="0,4" CornerRadius="5" BorderBrush="Orange" BorderThickness="1">
                                <Border Width="100" Height="20" VerticalAlignment="Top"  CornerRadius="5" BorderBrush="DarkOrange" BorderThickness="1" x:Name="mainBorder"  >
                                    <ContentPresenter  ContentSource="Header" VerticalAlignment="Top" HorizontalAlignment="Center" />
                                </Border>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="false">

                                <Setter Property="Background" TargetName="mainBorder" >
                                    <Setter.Value>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                            <GradientStop Color="Orange" Offset="0"></GradientStop>
                              
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type TabControl}">
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="Padding" Value="4,4,4,4"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Background" Value="#F9F9F9"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabControl}">
                        <Grid ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition x:Name="ColumnDefinition0"/>
                                <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
                                <RowDefinition x:Name="RowDefinition1" Height="*"/>
                            </Grid.RowDefinitions>
                            <Border  Grid.Column="0" Grid.Row="0" CornerRadius="3" BorderBrush="Black" BorderThickness="1" Padding="5" Background="#626262F0"> 
                            <TabPanel x:Name="HeaderPanel" IsItemsHost="true" Panel.ZIndex="1" KeyboardNavigation.TabIndex="1"/>
                                </Border>
                            <Border Margin="20,0,0,0" x:Name="ContentPanel" Grid.Column="0" Grid.Row="1" BorderThickness="1" CornerRadius="0,4,4,4" BorderBrush="Black"  Background="#626262F0">
                                <Border x:Name="InnerBd" BorderThickness="1"  CornerRadius="0,3,3,3">
                                    <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="{TemplateBinding Padding}" x:Name="PART_SelectedContentHost" ContentSource="SelectedContent"/>
                                </Border>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>

                            <Trigger Property="TabStripPlacement" Value="Bottom">
                                <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="1"/>
                                <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                                <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                                <Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
                                <Setter Property="Margin" TargetName="HeaderPanel" Value="2,0,2,2"/>
                                <Setter Property="CornerRadius" TargetName="ContentPanel" Value="4,4,4,0"/>
                                <Setter Property="CornerRadius" TargetName="InnerBd" Value="3,3,3,0"/>
                            </Trigger>
                            <Trigger Property="TabStripPlacement" Value="Left">
                                <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
                                <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                                <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="0"/>
                                <Setter Property="Grid.Column" TargetName="ContentPanel" Value="1"/>
                                <Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
                                <Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
                                <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                                <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
                                <Setter Property="Margin" TargetName="HeaderPanel" Value="0,2,2,2"/>
                            </Trigger>
                            <Trigger Property="TabStripPlacement" Value="Right">
                                <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
                                <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                                <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="1"/>
                                <Setter Property="Grid.Column" TargetName="ContentPanel" Value="0"/>
                                <Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
                                <Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
                                <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                                <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
                                <Setter Property="Margin" TargetName="HeaderPanel" Value="0,2,2,2"/>
                                <Setter Property="CornerRadius" TargetName="ContentPanel" Value="4,0,4,4"/>
                                <Setter Property="CornerRadius" TargetName="InnerBd" Value="3,0,3,3"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="50"></RowDefinition>
            <RowDefinition Height="600"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="110"></ColumnDefinition>
            <ColumnDefinition Width="14"></ColumnDefinition>
            <ColumnDefinition Width="1000"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="2" Margin="20,0">
            <Label>If the progress bar reached the maximum, the window will close itselfs.</Label>
            <ProgressBar Name="m_closeTimeoutBar" Maximum="50" Minimum="0" Value="50" Height="15"  ></ProgressBar>
        </StackPanel>
        <TabControl Name="m_tabControl" Grid.Row="1" Grid.ColumnSpan="3" TabStripPlacement="Left"  VerticalAlignment="Stretch">
            <TabItem Header="Test">
                <Label>sddsfasdf</Label>
            </TabItem>
            <TabItem Header="Test2">
                <Label>sddsfasdf</Label>
            </TabItem>
        </TabControl>
    </Grid>
</Window>
